package com.lyk.coursearrange.common.utils;

import com.alibaba.fastjson.JSONArray;
import com.lyk.coursearrange.common.core.text.SecurityConstants;
import com.lyk.coursearrange.util.ServletUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * 权限获取工具类
 */
public class SecurityUtils
{

    /**
     * 获取用户
     */
    public static String getUsername() {
        String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME);
        if (StringUtils.isEmpty(username)) {
            return "admin";
        }
        return ServletUtils.urlDecode(username);
    }
}
